<?php
require('../config.php');

		$user_id=$_REQUEST['user_id'];
		$start=0;
		$num=10;
		if(isset($_REQUEST['start'])) $start=$_REQUEST['start'];
		if(isset($_REQUEST['num'])) $num=$_REQUEST['num'];
		$sql="select m.id,m.shopid,m.shopname,m.shopqishu,m.gonumber from `".$oto."_member_go_record` as m where `uid`='{$user_id}' order by id DESC limit $start,$num";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$member_go_record[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($member_go_record))
		{
			for($i=0;$i<count($member_go_record);$i++)
			{
				$id=$member_go_record[$i]['shopid'];
				$sql="select s.thumb,s.q_user_code,s.q_uid,s.money from `".$oto."_shoplist` as s where s.id='{$id}'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$shoplist[$i]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(isset($shoplist[$i]))
				{
					$member_go_record[$i]['thumb']=$shoplist[$i]['thumb'];
					$member_go_record[$i]['q_user_code']=$shoplist[$i]['q_user_code'];
					$member_go_record[$i]['q_uid']=$shoplist[$i]['q_uid'];
					$member_go_record[$i]['money']=$shoplist[$i]['money'];
				} 
				else
				{
					$member_go_record[$i]['thumb']="";
					$member_go_record[$i]['q_user_code']="";
					$member_go_record[$i]['q_uid']="";
					$member_go_record[$i]['money']="";
				} 
			}
			echo json_encode($member_go_record);
		}
		else echo '[]';

?>